import request from '@/utils/request'

/**
 * @description: 获取一级分类下所有二级分类和分类下商品列表数据
 * @param {*} id 一级分类id
 * @return {*}
 */
export const findAllCategory = (id) => {
  return request('/category', 'get', { id })
}

/**
 * @description: 获取面包屑和筛选数据(包含父类目数据)
 * @param {*} id 路由id
 * @return {*}
 */
export const findSubCategoryFilter = (id) => {
  return request('/category/sub/filter', 'get', { id })
}

/**
 * @description: 获取筛选商品数据
 * @param {*} params: {
      page: 1,
      pageSize: 20,
      categoryId: route.params.id,
      sortField: null, // 排序类别
      attrs: [], // 商品属性
      brandId: null // 品牌名称
    }
 * @return {*}
 */
export const findSubCategoryGoods = (params) => {
  return request('/category/goods/temporary', 'post', params)
}
